home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / pcharstr.ps < prev    next >
Text File  |  1996-01-10  |  2KB  |  76 lines

  1. %    Copyright (C) 1990, 1992 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % pcharstr.ps
  16. % Print the CharStrings and Subrs (if present) from a Type 1 font,
  17. % in symbolic form.
  18.  
  19. % Load the Type 1 utilities.
  20. (type1ops.ps) run
  21.  
  22. /printcs
  23.  { dup type /stringtype eq
  24.     { printcs1 (\n) print }
  25.     { ( ) print == }
  26.    ifelse
  27.  } bind def
  28. /printcs1
  29.  { save exch
  30.    4330 exch dup length string .type1decrypt exch pop
  31.    dup length lenIV sub lenIV exch getinterval
  32.    0 () /SubFileDecode filter
  33.    mark exch charstack_read
  34.    counttomark 1 sub -1 0
  35.     { index ( ) print ==only
  36.     }
  37.    for cleartomark restore
  38.  } bind def
  39.  
  40. /pfbbox 4 array def
  41. /printfont
  42.  { currentfont begin Private begin 10 dict begin
  43.  
  44.     % Print the CharStrings and Subrs
  45.  
  46.    CharStrings { exch ==only printcs } forall
  47.    /Subrs where
  48.     { pop    % the dictionary
  49.       0 1 Subrs length 1 sub
  50.        { dup =only
  51.          Subrs exch get printcs
  52.        } for
  53.     } if
  54.  
  55.     % Print the bounding boxes
  56.  
  57.    gsave nulldevice FontMatrix matrix invertmatrix concat
  58.    0 1 Encoding length 1 sub
  59.     { dup Encoding exch get dup /.notdef eq
  60.        { pop pop
  61.        }
  62.        { 1 index =only ( ) print ==only ( ) print
  63.          ( ) dup 0 4 -1 roll put
  64.          newpath 0 0 moveto false charpath
  65.      pathbbox pfbbox astore ==
  66.        }
  67.       ifelse
  68.     } for
  69.    grestore
  70.  
  71.    end end end
  72.  } bind def
  73.